<?php
class Pageley_Controller_Dispatcher_Http_ErrorHandler implements Pageley_Controller_Dispatcher_ErrorHandler {
    private $errorCode;
    private $errorMessage;
    private $titleMessageKey;
    private $errorPage;
    
    public function __construct($errorCode = null, $errorMessage= null, $titleMessageKey = null, $errorPage = null) {
        $this->errorCode = $errorCode;
        $this->errorMessage = $errorMessage;
        $this->titleMessageKey = $titleMessageKey;
        if($errorPage === null) {
            $errorPage = $errorCode;
        }
        $this->errorPage = $errorPage;
    }
    
    public function handleError($model) {
        $model->put("errorCode", $this->errorCode);
        $model->put("errorMessage", $this->errorMessage);
        $model->put("titleMessageKey", $this->titleMessageKey);
        $model->put("errorPage", $this->errorPage);
    }
    
    public function setErrorCode($errorCode) {
        $this->errorCode = $errorCode;
    }
    
    public function setErrorMessage($errorMessage) {
        $this->errorMessage = $errorMessage;
    }
    
    public function setTitleMessageKey($titleMessageKey) {
        $this->titleMessageKey = $titleMessageKey;
    }
    
    public function setErrorPage($errorPage) {
        $this->errorPage = $errorPage;
    }
}
?>